home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
picmanip
/
pic_r2z
/
showspec
/
gfa512.lst
< prev
next >
Wrap
File List
|
1995-05-05
|
3KB
|
97 lines
Goto Main
Procedure Malloc(Amt,Ptr)
' Amt is how much memory we are setting aside, ptr is the pointer to the start
' of this memory...
Local Pg
' Pg is used to calculate an address divisible for 256 that is appropriate...
Pg=Int(Amt/256)
' Checks to see if what we will reserve will be enough for what we wanted...
' If not, we increase it...
If Amt Mod 256<>0
Inc Pg
Endif
' We set up how much we will actually reserve with Malloc...
Malloc_amt=Pg*256
' Reserves the memory, away from GFA Basic...
Reserve Fre(0)-Malloc_amt
' Now we pass ptr to the GEMDOS Malloc() call that will reserve memory from
' the ST's OS...
*Ptr=Gemdos(&H48,L:Malloc_amt)
Return
'
Procedure Mfree(Adr)
' Adr is just the starting address of the area reserved...
Local Er1
' Er1 is used to determine if an error occurred with the use of Mfree...
' We also give back the RAM to the OS and GFA Basic...
Er1=Gemdos(&H49,L:Adr)
Reserve Fre(0)+Malloc_amt-255
If Er1<>0
Cls
Print "Mfree() error ->";Er1
Endif
Return
'
Procedure Loader
Local X
' x is used to test for the existence of the file...
X=Exist(Name$)
If X<>-1 Then
Cls
Print "The program needs to have ";Name$;" present on the same path!"
Print " The program's execution has now been terminated..."
Stop
Endif
Bload Name$,Dest
Return
'
Main:
' Now I wanna allocate the memory for BOTH the compressed pic and the final
' displayable pic...
Gosub Malloc(104000,*Adr)
' Now, I'm gonna boot in the SPECTRUM 512 compressed pic, into the top most
' area of that reserved memory... what fun that will be...hehehehehe
' OK, so, anyways, we wanna have space for the TRIO code, for decompression
' and displaying of an .SPC pic...
Show$=Space$(675)
Show%=Varptr(Show$)
Decom$=Space$(235)
Decom%=Varptr(Decom$)
Name$="\show512.o"
Dest=Show%
Gosub Loader
Name$="\decomp.o"
Dest=Decom%
Gosub Loader
'
Main2:
Fileselect "\*.SPC","demo.spc",Name$
If Name$="" Then
Goto Termn8
Endif
Spc%=Adr+52000
Dest=Spc%
Gosub Loader
' Now, I run the decompression routine, supplied by TRIO Engineering...
' First we define the destinations for the bitmap and color data...
Bitm%=Adr
Colm%=Bitm%+32000
Dummy=C:Decom%(L:Spc%,L:Bitm%,L:Colm%)
If Dummy<>0 Then
Cls
Print "The SPECTRUM picture could not decompress... Reboot and try again!"
Stop
Endif
' Now we put the SPECTRUM pic onscreen until the user presses a key...
Void C:Show%(1,L:Bitm%,L:Colm%)
Repeat
Until Inkey$<>""
' We have to get the machine out of SPECTRUM mode...
Void C:Show%(0)
' We give memory back that was used for the .SPC and decompressed SPECTRUM
' pics...
Goto Main2
Termn8:
Gosub Mfree(Adr)
End